<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Object</title>
    <link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/default.min.css'>
    <script src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js'></script>
</head>
<body>
    <pre>
        <code>
            let person = {
                name:'xs',
                age:40,
                hobby:['play','足球'],
                1:100
            }
    
            // console.log('person.1',person.1); 会 语法错误
            console.log('person[1]',person[1]);
            console.log('person[name]',person['name']);
            console.log('person.name',person.name);
            console.log(person.hobby);
    
            // 属性删除 真删除 ==> delete 属性直接不在  假删除 ==> 属性 = null
    
            let done = delete person['age'] // 返回成功错误 true / false
            person.name = null
            console.log(done);
            console.log(person);
        </code>
    </pre>
    <script>hljs.highlightAll()</script>
    <script>
        let person = {
            name:'xs',
            age:40,
            hobby:['play','足球'],
            1:100
        }

        // console.log('person.1',person.1); 会 语法错误
        console.log('person[1]',person[1]);
        console.log('person[name]',person['name']);
        console.log('person.name',person.name);
        console.log(person.hobby);

        // 属性删除 真删除 ==> delete 属性直接不在  假删除 ==> 属性 = null

        let done = delete person['age'] // 返回成功错误 true / false
        person.name = null
        console.log(done);
        console.log(person);
    </script>
</body>
</html>